﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Breeding.Api.Application.Command.DeathManageCommand;
using S.Breeding.Api.Application.Command.OustManageCommand;

namespace S.Breeding.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheeponlyController : ControllerBase
    {
        private readonly IMediator mediator;
        public SheeponlyController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        #region 死亡管理
        /// <summary>
        /// 添加死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> AddDeathManage(DeathManageCreateCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdDeathManage(DeathManageUpdateCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 删除死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> DelDeathManage([FromQuery]DeathManageDeleteCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 批量删除死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchDeathManage([FromQuery]DeathManageBatchCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 死亡信息审核通过
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchTrueDeathManage([FromQuery]DeathManageTrueCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 死亡信息重新审核
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchFalseDeathManage([FromQuery]DeathManageFalseCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
        #endregion

        #region 淘汰管理
        /// <summary>
        /// 新增淘汰信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> AddOustManage(OustManageCreateCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改淘汰信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdOustManage(OustManageUpdateCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 删除淘汰信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> DelOustManage([FromQuery]OustManageDeleteCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 批量删除淘汰信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchOustManage([FromQuery]OustManageBatchCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 淘汰信息审核通过
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchTrueOustManage([FromQuery]OustManageTrueCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 淘汰信息重新审核
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> BatchFalseOustManage([FromQuery]OustManageFalseCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
        #endregion
    }
}
